package com.wc.算法提高课.C第三章_图论.欧拉回路和欧拉路径.铲雪车;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/10/22 2:34
 * @description https://www.acwing.com/problem/content/description/1125/
 */
public class Main {
    /**
     * 思路：欧拉回路<p>
     *     因为是双向边, 每个点的入度和出度相等, 所以一定存在欧拉回路, 相当于走两次欧拉回路, 每条边走一次
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int s, t;

    public static void main(String[] args) {
        s = sc.nextInt();
        t = sc.nextInt();
        double sum = 0;
        while (sc.hasNext()) {
            double x1 = sc.nextDouble(), y1 = sc.nextDouble();
            double x2 = sc.nextDouble(), y2 = sc.nextDouble();
            double dx = x1 - x2, dy = y1 - y2;
            sum += 2 * Math.sqrt(dx * dx + dy * dy);
        }
        int time = (int) Math.round(sum / 1000 / 20 * 60);
        int hour = time / 60, minutes = time % 60;
        out.printf("%d:%02d\n", hour, minutes);
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
